<!-- inc:head -->
<!-- 投票管理 -->
<!-- if($sysAct == "add") -->
<div class="notice" style="text-align:left;">
<a href="admin.php?file=index">系统首页</a> &raquo;
<a href="admin.php?file=vote&act=list">投票列表</a> &raquo;
添加投票
<input type="button" value="返回列表" onclick="tourl('admin.php?file=vote&act=list')">
</div>

<form name="qgform" method="post" action="admin.php?file=vote&act=addok" onSubmit="return chk_msg(this);">
<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
	<div class="left">主题：<span style="color:red;">*</span></div>
	<div class="right"><input type="text" name="subject" id="subject" class="long_input"></div>
	<div style="clear:both;"></div>
</div>

<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
	<div class="left">类型：<span style="color:red;">*</span></div>
	<div class="right">
		<input type="radio" name="vtype" value="single" id="vtype_single" onclick="chk_isall()" checked>单选
		<input type="radio" name="vtype" id="vtype_pl" value="pl">多选
	</div>
	<div style="clear:both;"></div>
</div>

<!-- $vote_array AS $key=>$value -->
<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
	<div class="left">选项{:$value}：</div>
	<div class="right">
		<input type="text" name="subject_{:$value}" class="long_input">
		&nbsp;<input type="text" name="hits_{:$value}" value="0" class="short_input" style="text-align:center;" title="点击率">
		&nbsp; <input type="checkbox" name="ifcheck_{:$value}" id="ifcheck_{:$value}" onclick="chk_is('ifcheck_{:$value}')" title="默认是否选中，选中请打勾" />
	</div>
	<div style="clear:both;"></div>
</div>
<!-- end -->
<div class="table">
	<div class="left"></div>
	<div class="right">
		<input type="submit" id="creat_button" class="mybutton_01" value="添加投票">
		&nbsp; <span id="show_step" style="color:red;"></span>
	</div>
	<div style="clear:both;"></div>
</div>
</form>

<script type="text/javascript">
function chk_msg(format)
{
	var subject = $("subject").value;
	if(!subject)
	{
		alert("主题不允许为空");
		return false;
	}
	$("show_step").innerHTML = "<img src='admin/tpl/images/loading.gif' border='0' align='absmiddle'> 正在保存数据，如果网页没有动静请刷新...";
	$("creat_button").disabled = true;
}
function chk_isall()
{
	var stype = $("vtype_single").checked;
	var input = document.getElementsByTagName("input");
	if(stype)
	{
		for(var i=0; i<input.length; i++)
		{
			if(input[i].type.toLowerCase() == "checkbox")
			{
				input[i].checked = false;
			}
		}
	}
}
function chk_is(id)
{
	chk_isall();
	$(id).checked = true;
	//
}
</script>
<!-- elseif($sysAct == "modify") -->
<div align="center">
<div class="notice" style="text-align:left;">
<a href="admin.php?file=index">系统首页</a> &raquo;
<a href="admin.php?file=vote&act=list">投票列表</a> &raquo;
编辑投票
<input type="button" value="返回列表" onclick="tourl('admin.php?file=vote&act=list')">
</div>
</div>

<form name="qgform" method="post" action="admin.php?file=vote&act=modifyok&id={:$id}" onSubmit="return chk_msg(this);">
<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
	<div class="left">主题：<span style="color:red;">*</span></div>
	<div class="right"><input type="text" name="subject" id="subject" class="long_input" value="{:$rs[subject]}"></div>
	<div style="clear:both;"></div>
</div>

<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
	<div class="left">类型：<span style="color:red;">*</span></div>
	<div class="right">
		<input type="radio" name="vtype" value="single" id="vtype_single" onclick="chk_isall()"{if($rs[vtype] == "single")} checked{end}>单选
		<input type="radio" name="vtype" id="vtype_pl" value="pl"{if($rs[vtype] == "pl")} checked{end}>多选
	</div>
	<div style="clear:both;"></div>
</div>
<!-- $rslist AS $key=>$value -->
<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
	<div class="left">已选项{:$value[id]}：</div>
	<div class="right">
		<input type="text" name="vsubject_{:$value[id]}" class="long_input" value="{:$value[subject]}">
		&nbsp;<input type="text" name="vhits_{:$value[id]}" value="{:$value[vcount]}" class="short_input" style="text-align:center;" title="点击率">
		&nbsp; <input type="checkbox" name="vifcheck_{:$value[id]}" id="vifcheck_{:$value[id]}" onclick="chk_is('vifcheck_{:$value[id]}')" title="默认是否选中，选中请打勾"{if($value[ifcheck] == 1)} checked{end} />
	</div>
	<div style="clear:both;"></div>
</div>
<!-- end -->

<!-- $vote_array AS $key=>$value -->
<div class="table" onmouseover="this.className='table table1'" onmouseout="this.className='table'">
	<div class="left">新选项{:$value}：</div>
	<div class="right">
		<input type="text" name="subject_{:$value}" class="long_input">
		&nbsp;<input type="text" name="hits_{:$value}" value="0" class="short_input" style="text-align:center;" title="点击率">
		&nbsp; <input type="checkbox" name="ifcheck_{:$value}" id="ifcheck_{:$value}" onclick="chk_is('ifcheck_{:$value}')" title="默认是否选中，选中请打勾" />
	</div>
	<div style="clear:both;"></div>
</div>
<!-- end -->
<div class="table">
	<div class="left"></div>
	<div class="right">
		<input type="submit" id="creat_button" class="mybutton_01" value="编辑投票">
		&nbsp; <span id="show_step" style="color:red;"></span>
	</div>
	<div style="clear:both;"></div>
</div>
</form>

<script type="text/javascript">
function chk_msg(format)
{
	var subject = $("subject").value;
	if(!subject)
	{
		alert("主题不允许为空");
		return false;
	}
	$("show_step").innerHTML = "<img src='admin/tpl/images/loading.gif' border='0' align='absmiddle'> 正在保存数据，如果网页没有动静请刷新...";
	$("creat_button").disabled = true;
}
function chk_isall()
{
	var stype = $("vtype_single").checked;
	var input = document.getElementsByTagName("input");
	if(stype)
	{
		for(var i=0; i<input.length; i++)
		{
			if(input[i].type.toLowerCase() == "checkbox")
			{
				input[i].checked = false;
			}
		}
	}
}
function chk_is(id)
{
	chk_isall();
	$(id).checked = true;
	//
}
</script>
<!-- else -->
<div class="notice" style="text-align:left;">
<a href="admin.php?file=index">系统首页</a> &raquo;
<a href="admin.php?file=vote&act=list">投票列表</a>
<input type="button" value="添加新投票" onclick="tourl('admin.php?file=vote&act=add')">
</div>
<table width='100%' cellpadding='0' cellspacing='0'>
<tr>
	<td width='10%' class="t_sub">ID</td>
	<td class="t_sub">主题</td>
	<td width="23%" class="t_sub">操作</td>
</tr>
<!-- $rslist AS $key=>$value -->
<tr class="tr_out" onMouseOver="this.className='tr_over'" onMouseOut="this.className='tr_out'">
	<td height='28px' align='center' class="tc_left">{:$value[id]}</td>
	<td align='left' class="tc_right">&nbsp;{:$value[subject]}</td>
	<td align='center' class="tc_right">
		<input type="button" value="编辑" onclick="qg_modify({:$value[id]})">
		<input type="button" value="删除" onclick="qg_delete({:$value[id]});">
	</td>
</tr>
<!-- end -->
</table>
<script type="text/javascript">
function qg_modify(id)
{
	window.location.href="admin.php?file=vote&act=modify&id="+id;
}
function qg_delete(id)
{
	//判断是否删除
	question = confirm("确认删除该信息吗？特别说明，删除后无法恢复！");
	if (question != "0")
	{
		window.location.href="admin.php?file=vote&act=delete&id="+id;
	}
}
</script>
<!-- end -->

<!-- inc:foot -->